{extend name="PublicBase/showBase" /}

{block name="body"}
<div class="main">
    <div class="row">
        <div class="col-md-12">
            <section class="tile color transparent-black">
                <div class="tile-header bg-transparent-black-2">
                    <h1>
                        {if condition="$Info eq ''"}
                            {:lang('WxCdXz')}
                        {else /}
                            {:lang('WxCdGx')}
                        {/if}
                    </h1>
                    <div class="controls">
                        <a href="javascript:void(0);" onclick="window.history.back();"><i class="fa fa-arrow-left"></i></a>
                        {if condition="$Info eq ''"}
                            <a href="{:url('WechatMenu/showAdd')}"><i class="fa fa-refresh"></i></a>
                        {else /}
                            <a href="{:url('WechatMenu/showEdit', array('id'=>$Info['menu_id']))}"><i class="fa fa-refresh"></i></a>
                        {/if}
                    </div>
                </div>
                <div class="tile-body nopadding">
                    <form class="FormTable" action="" method="post">
                        <div class="tile-body">
                            <div class="row">
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxCdFj')}</label>
                                    <select class="chosen-select chosen-transparent form-control" name="menu_pid">
                                        <option value="0" {eq name="Info['menu_pid']" value="0"}selected{/eq}>{:lang('WxCdDj')}</option>
                                        {volist name="Menu" id="vo"}
                                            <option value="{$vo.menu_id}" {eq name="Info['menu_pid']" value="$vo['menu_id']"}selected{/eq}>{$vo.menu_title}</option>
                                        {/volist}
                                    </select>
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxCdMc')}</label>
                                    <input type="text" class="form-control" name="menu_title" value="{$Info.menu_title}" placeholder="{:lang('WxCdMcWk')}" />
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxCdLx')}</label>
                                    <select class="chosen-select chosen-transparent form-control" name="menu_type" id="menu_type">
                                        {volist name="Type" id="vo"}
                                            <option value="{$vo.content_value}" {eq name="Info['menu_type']" value="$vo['content_value']"}selected{/eq}>{$vo.content_name}</option>
                                        {/volist}
                                    </select>
                                </div>
                                <div class="form-group col-sm-12 menu_key" style="display: none;">
                                    <label>{:lang('WxCdGjc')}</label>
                                    <input type="text" class="form-control" name="menu_key" value="{$Info.menu_key}" placeholder="{:lang('WxCdGjcWk')}" />
                                </div>
                                <div class="form-group col-sm-12 menu_link" style="display: none;">
                                    <label>{:lang('WxCdWz')}</label>
                                    <input type="text" class="form-control" name="menu_link" value="{$Info.menu_link}" placeholder="{:lang('WxCdWzWk')}" />
                                </div>
                                <div class="form-group col-sm-12 menu_program" style="display: none;">
                                    <label>{:lang('WxCdXcxId')}</label>
                                    <input type="text" class="form-control" name="menu_appid" value="{$Info.menu_appid}" placeholder="{:lang('WxCdXcxIdWk')}" />
                                </div>
                                <div class="form-group col-sm-12 menu_program" style="display: none;">
                                    <label>{:lang('WxCdXcxLj')}</label>
                                    <input type="text" class="form-control" name="menu_paths" value="{$Info.menu_paths}" placeholder="{:lang('WxCdXcxLjWk')}" />
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxCdZt')}</label>
                                    <select class="chosen-select chosen-transparent form-control" name="menu_state">
                                        <option value="1" {eq name="Info['menu_state']" value="1"}selected{/eq}>{:lang('WxCdZt1')}</option>
                                        <option value="2" {eq name="Info['menu_state']" value="2"}selected{/eq}>{:lang('WxCdZt2')}</option>
                                    </select>
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxCdPx')}</label>
                                    <input type="text" class="form-control" name="menu_sort" value="{$Info.menu_sort|default=0}" placeholder="{:lang('WxCdPxWk')}{:lang('WxCdPxAl')}" maxlength="3" />
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="tile-footer bg-transparent-black-2 rounded-bottom-corners">
                    <div class="row">
                        <div class="col-sm-12 text-center">
                            <button type="button" class="btn btn-{:config('CNF_BTNCOLOR')} ajax-post">{:lang('XtAnTj')}</button>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>
{/block}

{block name="script"}
    <script>
        $(function(){
            {if condition="$Info['menu_type'] eq 1"}
                $('.menu_key,.menu_link,.menu_program').hide();
            {elseif condition="$Info['menu_type'] eq 2" /}
                $('.menu_link').show();
            {elseif condition="$Info['menu_type'] eq 3" /}
                $('.menu_key').show();
            {elseif condition="$Info['menu_type'] eq 4" /}
                $('.menu_link,.menu_program').show();
            {/if}

            $('#menu_type').change(function(){
                $('.menu_key,.menu_link,.menu_program').hide();
                var menu_type = $('#menu_type').val();
                if(menu_type == 1){
                    $('.menu_key,.menu_link,.menu_program').hide();
                }else if(menu_type == 2){
                    $('.menu_link').show();
                }else if(menu_type == 3){
                    $('.menu_key').show();
                }else if(menu_type == 4){
                    $('.menu_link,.menu_program').show();
                }
            });
        })
    </script>
{/block}
      
